package com.edu.api.entity.coursedto;

import com.edu.api.entity.course.Teacher;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 课程
 * @TableName course
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(indexName = "coursedto",type = "item", shards = 1, replicas = 0)
public class CourseDto implements Serializable {
    /**
     * id
     */
    @Field(type = FieldType.Integer)
    private Integer id;

    /**
     * 课程名
     */
    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String courseName;

    /**
     * 课程一句话简介
     */
    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String brief;

    /**
     * 原价
     */
    @Field(type = FieldType.Double)
    private Double price;

    /**
     * 原价标签
     */
    @Field(type = FieldType.Keyword,index = false)
    private String priceTag;

    /**
     * 优惠价
     */
    @Field(type = FieldType.Double)
    private Double discounts;

    /**
     * 优惠标签
     */
    @Field(type = FieldType.Keyword,index = false)
    private String discountsTag;

    /**
     * 描述markdown
     */
    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String courseDescriptionMarkDown;

    /**
     * 课程描述
     */
    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String courseDescription;

    /**
     * 课程展示图
     */
    @Field(type = FieldType.Keyword,index = false)
    private String courseImgUrl;

    /**
     * 是否新品
     */
    @Field(type = FieldType.Boolean,index = false)
    private Boolean isNew;

    /**
     * 广告语
     */
    @Field(type = FieldType.Keyword)
    private String isNewDes;

    /**
     * 最后操作者
     */
    @Field(type = FieldType.Integer,index = false)
    private Integer lastOperatorId;

    /**
     * 自动上架时间
     */
    @Field(type = FieldType.Date,index = false)
    private Date autoOnlineTime;

    /**
     * 记录创建时间
     */
    @Field(type = FieldType.Date,index = false)
    private Date createTime;

    /**
     * 更新时间
     */
    @Field(type = FieldType.Date,index = false)
    private Date updateTime;

    /**
     * 是否删除
     */
    @Field(type = FieldType.Boolean,index = false)
    private Boolean isDel;

    /**
     * 总时长(分钟)
     */
    @Field(type = FieldType.Integer,index = false)
    private Integer totalDuration;

    /**
     * 课程缩略图
     */
    @Field(type = FieldType.Keyword,index = false)
    private String courseListImg;

    /**
     * 课程状态，0-草稿，1-上架
     */
    @Field(type = FieldType.Integer,index = false)
    private Integer status;

    /**
     * 课程排序，用于后台保存草稿时用到
     */
    @Field(type = FieldType.Integer,index = false)
    private Integer sortNum;

    /**
     * 课程预览第一个字段
     */
    @Field(type = FieldType.Keyword,index = false)
    private String previewFirstField;

    /**
     * 课程预览第二个字段
     */
    @Field(type = FieldType.Keyword,index = false)
    private String previewSecondField;

    /**
     * 销量
     */
    @Field(type = FieldType.Integer,index = false)
    private Integer sales;

    /**
     * 教师
     */
    @Field(type = FieldType.Object,index = false)
    private Teacher teacher;

    /**
     * 课程
     */
    @Field(type = FieldType.Object,index = false)
    private List<CourseSectionDto> courseSections;

    private static final long serialVersionUID = 1L;
}